package com.atguigu.cmsservice.controller;


import com.atguigu.cmsservice.entity.CrmBanner;
import com.atguigu.cmsservice.service.CrmBannerService;
import com.atguigu.commonutils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-02-11
 */
@Api(tags = "前台banner展示")
@RestController
@RequestMapping("/cmsservice/crm-banner-api")
public class CrmBannerApiController {
    @Autowired
    private CrmBannerService bannerService;

    //查询所有banner
    @ApiOperation(value = "查询所有banner")
    @GetMapping("getAllBanner")
    public R getAllBanner() {
        List<CrmBanner> list = bannerService.getAllBanner();
        return R.ok().data("list",list);
    }

//    //查询指定banner
//    @ApiOperation(value = "获取Banner")
//    @GetMapping("getBannerById/{id}")
//    public R getBannerById(@PathVariable String id) {
//        CrmBanner crmBanner = bannerService.getBannerById(id);
//        return R.ok().data("item",crmBanner);
//    }
//
//    //2 添加banner
//    @PostMapping("addBanner")
//    public R addBanner(@RequestBody CrmBanner crmBanner) {
//        bannerService.saveBanner(crmBanner);
//        return R.ok();
//    }
//
//    @ApiOperation(value = "修改Banner")
//    @PutMapping("update")
//    public R updateById(@RequestBody CrmBanner banner) {
//        bannerService.updateBannerById(banner);
//        return R.ok();
//    }
//
//    @ApiOperation(value = "删除Banner")
//    @DeleteMapping("remove/{id}")
//    public R remove(@PathVariable String id) {
//        bannerService.removeBannerById(id);
//        return R.ok();
//    }
}

